FROM core.harbor.ucloud:5000/library/alpine-wkhtmltopdf:3.15.0-0.12.6-full as wkhtmltopdf
FROM core.harbor.ucloud:5000/base/alpine:3.13

WORKDIR /srv/app/peilian-api

RUN rm -f /etc/localtime && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone

RUN mkdir logs
RUN mkdir -p /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories &&  \
    apk update && \
    apk add --no-cache \
    libstdc++  \
    libx11  \
    libxrender  \
    libxext  \
    libssl1.1  \
    ca-certificates  \
    fontconfig  \
    freetype  \
    ttf-dejavu \
    ffmpeg

COPY static/fonts/simhei.ttf /usr/share/fonts/simhei.ttf
COPY static/fonts/yahei.ttf /usr/share/fonts/yahei.ttf

COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage
COPY --from=wkhtmltopdf /bin/libwkhtmltox* /bin/

COPY bin bin
COPY config config
COPY templates templates
COPY static static

ENV TZ=Asia/Shanghai
#安装时区数据包
RUN apk add tzdata
#设置时区
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone

EXPOSE 80

CMD ["./bin/peilian-api"]
